// 引入Ant Design
import {
  Anchor,
  Breadcrumb,
  Button,
  Carousel,
  Col,
  Divider,
  Dropdown,
  Form,
  Icon,
  Input,
  InputNumber,
  Layout,
  Menu,
  Modal,
  Radio,
  Row,
  Select,
  Skeleton,
  Spin,
  Steps,
  Timeline,
  Tooltip,
  Upload,
  message
} from 'ant-design-vue';
import { VueConstructor } from 'vue';

// eslint-disable-next-line max-statements
export default (Vue: VueConstructor) => {
  // 使用ant-design
  Vue.use(Anchor);
  Vue.use(Breadcrumb);
  Vue.use(Button);
  Vue.use(Carousel);
  Vue.use(Col);
  Vue.use(Divider);
  Vue.use(Dropdown);
  Vue.use(Form);
  Vue.use(Icon);
  Vue.use(Input);
  Vue.use(InputNumber);
  Vue.use(Layout);
  Vue.use(Menu);
  Vue.use(Modal);
  Vue.use(Radio);
  Vue.use(Row);
  Vue.use(Select);
  Vue.use(Skeleton);
  Vue.use(Spin);
  Vue.use(Steps);
  Vue.use(Timeline);
  Vue.use(Tooltip);
  Vue.use(Upload);

  // 配置message
  message.config({
    // Antd.message.config({
    top: '50px',
    duration: 3,
    maxCount: 3
  });

  // 向Vue中封装ant-design方法
  Vue.prototype.$confirm = Modal.confirm;
  Vue.prototype.$error = Modal.error;
  Vue.prototype.$info = Modal.info;
  Vue.prototype.$message = message;
  Vue.prototype.$success = Modal.success;
  Vue.prototype.$warning = Modal.warning;

  // 注册IconFont
  const IconFont = Icon.createFromIconfontCN({
    scriptUrl: '//at.alicdn.com/t/font_1273083_mdx9k4jasy.css'
  });

  // 全局注册IconFont
  Vue.component('icon-font', IconFont);
};
